home *** CD-ROM | disk | FTP | other *** search
- Path: fsgi01.fnal.gov!not-for-mail
- From: b91926@fsgi01.fnal.gov (David Sachs)
- Newsgroups: comp.lang.c++
- Subject: Re: Virtual function does not make any sense unless it is pure.
- Date: 12 Apr 1996 13:36:47 -0500
- Organization: FERMILAB, Batavia, IL
- Message-ID: <4km7rv$6uh@fsgi01.fnal.gov>
- References: <4kkhbc$nj4@brahms.udel.edu>
- Reply-To: sachs@fnal.fnal.gov
- NNTP-Posting-Host: fsgi01.fnal.gov
- X-Newsreader: NN version 6.5.0 #9 (NOV)
-
- yuehong@brahms.udel.edu (Yue-hong Zheng) writes:
-
-
- >Can any body give me any examples to show non-pure virtual function does
- >make sense?
-
- One common situation, where a non-pure virtual function is desirable,
- is when the function for the derived class adds to rather than replaces
- the action of the base class function. In such cases the derived
- class function at some point calls the base class function. This could
- call a chain of calls, in which a virtual function call calls a function
- in the most derived class, which calls the same function in its base
- class ...
-
- There are many situations in which this occurs: cloning an object,
- operating on a complex graphic object ...
-
- non-pur virtual function are probably more common than pur ones.
- --
- ***** The stories about the first lady are hilarious. *****
- David Sachs - Fermilab, HPPC MS369 - P. O. Box 500 - Batavia, IL 60510
- Voice: 1 708 840 3942 Deparment Fax: 1 708 840 3785
-